package il.ac.braude.sona.entities;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;

/**
 * Defines ExtensionRequest entity
 * @author  Ofek Ron
 * @author Avihay Avitan
 * @author Nitzan Inbar
 * @author Sasha Rozenthal
 * Laboratory in Software Engineering,Ort Braude College.</p>
 *
 */

@SuppressWarnings("serial")
public class ExtensionRequest implements Serializable {
	public static String[] fields = {"rid","sid","uid","extension_days","explanation","decision"};
	public HashMap<String,String> values = new HashMap<String,String>();
	
	/**
	 * Class constructor
	 * @param rs The fields from database
	 * @throws SQLException
	 */
	public ExtensionRequest(ResultSet rs) throws SQLException {
		for (String f : fields) 
			values.put(f, rs.getString(f));
	}
	/**
	 * Class getter.
	 * @param key the key of line to return.
	 * @return database line.
	 */
	public String getValue(String key) {
		return values.get(key);
	}
	/**
	 * Class setter.
	 * @param key the key of line to input.
	 */
	public void setValueDecision(String key) {
		fields[5] = new String(key);
	}
	
	
}
